<extend name="public@base5"/>
<block name="main">
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="nav-item">
				<a class="nav-link" href="{:url('Store/index')}">商品列表</a>
			</li>
			<li class="nav-item">
				<a class="nav-link active" href="{:url('Store/add')}">编辑商品</a>
			</li>
		</ul>
		<form method="post" class="js-ajax-form margin-top-20" action="admin/stores">
                    <input type='hidden' name='id' value='{$id}'>
			<div class="row mb-3">
				<label for="input-item_name" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>商品名称</label>
				<div class="col-md-8 col-sm-10">
					<input type="text" class="form-control" id="input-item_name" name="item_name" value='{$item_name}'>
				</div>
			</div>
                        <div class="row mb-3">
				<label for="input-item_type" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>商品类型</label>
				<div class="col-md-8 col-sm-10">
					<input type="text" class="form-control" id="input-item_type" name="item_type" value='{$item_type}'>
				</div>
			</div>
			<div class="row mb-3">
				<label for="input-item_desc" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>商品描述</label>
				<div class="col-md-8 col-sm-10">
					<input type="text" class="form-control" id="input-item_desc" name="item_desc" value='{$item_desc}'>
				</div>
			</div>
			<div class="row mb-3">
				<label for="input-item_price" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>价格</label>
				<div class="col-md-8 col-sm-10">
					<input type="number" class="form-control" id="input-item_price" name="item_price" value='{$item_price}'>
				</div>
			</div>
                        <div class="row mb-3">
				<label for="input-item_num" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>库存</label>
				<div class="col-md-8 col-sm-10">
					<input type="number" class="form-control" id="input-item_num" name="item_num" value="{$item_num|default=0}">
				</div>
			</div>
                        <div class="row mb-3">
				<label for="item_icon" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>图标</label>
				<div class="col-md-8 col-sm-10">
					<input type="hidden" name="item_icon" id="item_icon"
                                       value="{$item_icon|default=''}">
                                <a href="javascript:uploadOneImage('图片上传','#item_icon');">
                                    <if condition="empty($item_icon)">
                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                             id="item_icon-preview"
                                             width="135" style="cursor: pointer"/>
                                        <else/>
                                        <img src="{:cmf_get_image_preview_url($item_icon)}"
                                             id="item_icon-preview"
                                             width="135" style="cursor: pointer"/>
                                    </if>
                                </a>
                                <br>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
				</div>
			</div>
			
			<div class="row mb-3">
				<div class="offset-md-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">
						<i class="fa fa-save fa-fw"></i> {:lang('SAVE')}
					</button>
				</div>
			</div>
		</form>
	</div>
</block>
